﻿/*
 * zpath_unittest.cxx
 *
 *  Created on: 2015年3月4日
 *      Author: Fifi Lyu
 */

#include <gtest/gtest.h>
#include "zpsoe/zalgorithm/zpath.h"

using namespace zpsoe::zalgorithm;

TEST(ZpathTest, base_name) {
#ifdef PLATFORM_WIN32
    EXPECT_STREQ("test.txt", zpath::base_name("D:\\test.txt").c_str());
#else
    EXPECT_STREQ("test.txt", zpath::base_name("/tmp/test.txt").c_str());
#endif
}

TEST(ZpathTest, dir_name) {
#ifdef PLATFORM_WIN32
    EXPECT_STREQ("D:", zpath::dir_name("D:\\test.txt").c_str());
    EXPECT_STREQ("D:\\dir", zpath::dir_name("D:\\dir\\test.txt").c_str());
#else
    EXPECT_STREQ("/tmp", zpath::dir_name("/tmp/test.txt").c_str());
#endif
}
